home *** CD-ROM | disk | FTP | other *** search
Oberon Text | 1995-05-08 | 2.6 KB | 83 lines | [TEXT/.Ob4] |
- Syntax10.Scn.Fnt
- FoldElems
- Syntax10.Scn.Fnt
- (*----------------------------------------------------------------
- Dsp offers screen output in low-level modules that can neither import Out nor Texts.
- It directly draws into the right bottom corner of the screen overwriting anything which
- is displayed there. If the output area has been filled by Dsp the lines wrap around and
- the output goes to the first line of the output area again.
- Dsp.Set(x, y)
- sets the top-left corner of the output rectangle (default = (800, 400)).
- Dsp.Char(ch)
- writes ch.
- Dsp.Ln
- skips to the next line.
- Dsp.String(s)
- writes string s.
- Dsp.Int(x)
- writes number x with as many digits as necessary.
- Dsp.Off
- switches further output off. Anything written with Dsp will be invisible.
- Dsp.On
- switches further output on again.
- Dsp.Reset
- Clears the output area.
- ----------------------------------------------------------------*)
- Syntax10i.Scn.Fnt
- StampElems
- Alloc
- 8 May 95
- Syntax10b.Scn.Fnt
- Documentation
- MODULE Dsp; (* HM
- IMPORT Display, Fonts;
- Y: INTEGER; (*current base line*)
- X: INTEGER; (*position of next character in base line*)
- top, left: INTEGER; (*left margin of current line*)
- on: BOOLEAN;
- fnt: Display.Font;
- dsr, lsp: INTEGER;
- PROCEDURE Set* (x, y: INTEGER);
- BEGIN left := x; top := y; X := x; Y := y;
- Display.ReplConst(Display.black, left, 1, Display.Width - left - 1, top + dsr + lsp - 1, Display.replace)
- END Set;
- PROCEDURE Char* (ch: CHAR);
- VAR dx, x, y, w, h: INTEGER; pat: Display.Pattern;
- BEGIN
- IF on THEN
- Display.GetChar(fnt, ch, dx, x, y, w, h, pat);
- Display.CopyPattern(Display.white, pat, X + x, Y + y, Display.replace);
- X := X + dx
- END Char;
- PROCEDURE Ln*;
- BEGIN
- IF on THEN
- X := left; Y := Y - lsp;
- IF Y + dsr < 0 THEN Set(left, top) END
- END Ln;
- PROCEDURE String* (s: ARRAY OF CHAR);
- VAR i: INTEGER;
- BEGIN
- i := 0; WHILE s[i] # 0X DO Char(s[i]); INC(i) END
- END String;
- PROCEDURE Int* (n: LONGINT);
- VAR d: ARRAY 10 OF CHAR; i: INTEGER;
- BEGIN
- IF n < 0 THEN Char("-"); n := -n END;
- i := 0; REPEAT d[i] := CHR(30H + n MOD 10); n := n DIV 10; INC(i) UNTIL n = 0;
- REPEAT DEC(i); Char(d[i]) UNTIL i = 0
- END Int;
- PROCEDURE On*;
- BEGIN on := TRUE
- END On;
- PROCEDURE Off*;
- BEGIN on := FALSE
- END Off;
- PROCEDURE Reset*;
- BEGIN Set(left, top)
- END Reset;
- BEGIN
- fnt := Fonts.Default.raster; lsp := Fonts.Default.height; dsr := Fonts.Default.minY;
- Set(800, 400); Off
- END Dsp.
-